package com.base.common.persistent.dao;

import java.util.Date;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

import com.base.common.persistent.model.Meeting;
import com.base.common.persistent.model.MeetingConfig;
import com.cjy.common.annotation.MyBatisRepository;

@MyBatisRepository
public interface MeetingMapper {

	/**
	 * 添加会议
	 * 
	 * @param meeting
	 * @return
	 */
	public int addMeeting(Meeting meeting);

	/**
	 * 根据会议编号查询会议信息
	 * 
	 * @param code
	 * @return
	 */
	public Meeting queryMeetingByCode(@Param(value = "code") String code);

	public List<Meeting> queryMeetingByStatusAndSignPointId(
			@Param(value = "status") int status,
			@Param(value = "signPointId") int signPointId);
	
	public List<Meeting> queryMeetingByStatusAndId(
			@Param(value = "status") int status,
			@Param(value = "id") int id);

	public List<Meeting> queryUotBeginningMeetingInHalfHour();
	
	/**
	 * 查询最新的会议编号
	 * 
	 * @return
	 */
	public String queryLastCode();
	
	public int updateStatusById(@Param(value = "id") int id, @Param(value = "status") int status);

	public List<Meeting> queryFinishedMeeting();

	/**
	 * 条件查询会议
	 * 
	 * @param conditions
	 * @return
	 */
	public List<Meeting> queryMeetingsByCondition(Map<String, Object> conditions);

	/**
	 * 条件查询会议总条数
	 * 
	 * @param conditions
	 * @return
	 */
	public int queryMeetingCountsByCondition(Map<String, Object> conditions);
	
	/**
	 * 查询会议配置
	 * 
	 * @param code
	 * @return
	 */
	public List<MeetingConfig> queryMeetingConfig(@Param(value = "code")String code);

	/**
	 * 根据ID查询会议
	 * 
	 * @param meetingId
	 * @return
	 */
	public Meeting queryMeetingById(int meetingId);

	/**
	 * 更新会议信息
	 * 
	 * @param meetingId
	 * @param name
	 * @param description
	 * @param startTime
	 * @param endTime
	 * @return
	 */
	public int updateMeetingById(@Param("meetingId")int meetingId, @Param("name")String name, @Param("description")String description, @Param("startTime")Date startTime, @Param("endTime")Date endTime);
}
